package vn.student.mode;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.EditText;

public class EditLine extends EditText{
    static final Paint mPaint=new Paint();;
    static final Rect mRect=new Rect();
    public EditLine(Context context, AttributeSet attrs) {
	super(context, attrs);
 
	mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setColor(Color.RED);
        mPaint.setPathEffect(new DashPathEffect(new float[]{10,20}, 1));
        mPaint.setStrokeWidth(1);

    }    
    @Override
    protected void onDraw(Canvas canvas) {
        
	super.onDraw(canvas);
	int count= getLineCount();
	Rect r= mRect;
	Paint p=mPaint;
	
	
	for(int i=1;i<=10;i++)
	{
	    canvas.drawLine(r.left, i*	getLineHeight()+8, r.right, i*	getLineHeight()+8, p);
	}
	for(int i=0;i<count;i++)
	{
	    int baseline= getLineBounds(i, r);
	   // Log.d("đo dai",baseline+"");
	    canvas.drawLine(r.left, (baseline+1), r.right, (baseline+1), p);
	}
    }
    
   
}
